Repository Public
1// Auteur : Simon-Pierre Boucher — contact@spboucher.ai2// Atelier « mon évaluation » : l'utilisateur choisit ses comparables, les ajuste,3// réconcilie sa valeur et la compare à la mesure Vrai-Prix et au prix demandé.4import type { Metadata } from "next";5import { notFound } from "next/navigation";6import { getListing } from "@/lib/immoka";7import EvalWorkbench, { type WorkbenchHead } from "@/components/avendre/EvalWorkbench";8import { moneyFr } from "@/lib/seo";910export const dynamic = "force-dynamic";1112function head(uid: string): WorkbenchHead | null {13 const det = getListing(uid);14 if (!det) return null;15 const l = det.listing;16 const e = det.eval;17 return {18 uid: l.uid,19 address: l.address,20 city: l.city,21 propertyType: l.property_type,22 group: det.group,23 price: l.price,24 image: det.images[0] ?? null,25 bedrooms: l.bedrooms,26 bathrooms: l.bathrooms,27 areaSqft: l.area_sqft,28 lotSqft: l.lot_sqft,29 yearBuilt: l.year_built,30 geolocated: l.lat != null && l.lng != null,31 eval: e32 ? {33 est: e.est,34 low: e.low,35 high: e.high,36 confidence: e.confidence,37 modelEst: e.model_est,38 compsEst: e.comps_est,39 costEst: e.cost_est,40 roleEst: e.role_est,41 ensEst: e.ens_est,42 valeurRole: e.valeur_role,43 nComps: e.n_comps,44 unitId: e.unit_id,45 evaluatedAt: e.evaluated_at,46 }47 : null,48 };49}5051export async function generateMetadata({ params }: { params: Promise<{ uid: string }> }): Promise<Metadata> {52 const { uid } = await params;53 const h = head(decodeURIComponent(uid));54 if (!h) return { title: "Propriété introuvable" };55 const where = [h.address, h.city].filter(Boolean).join(", ");56 return {57 title: `Mon évaluation — ${where} (${moneyFr(h.price)})`,58 description: "Atelier : choisir ses comparables, les ajuster en dollars, réconcilier une valeur et la comparer à la mesure Vrai-Prix.",59 robots: { index: false, follow: false },60 };61}6263export default async function EvaluerPage({ params }: { params: Promise<{ uid: string }> }) {64 const { uid } = await params;65 const h = head(decodeURIComponent(uid));66 if (!h) notFound();67 return <EvalWorkbench head={h} />;68}69